package com.honeybee.cloud.framework.common.page;

import lombok.Data;

import java.util.List;
import java.util.Objects;

/**
 * @Description 分页
 * @Author DELL
 * @Create 2019-02-11
 * @Since 1.0.0
 */

@Data
public class Page<T> {
    private long total;
    private long size;
    private long current;
    private List<T> records;

    private Boolean hasNext;

    private Boolean hasPre;

    public Boolean getHasNext() {
        if (Objects.isNull(current) || Objects.isNull(total)) {
            return false;
        }
        if (current < total) {
            return true;
        }
        return false;
    }


    public Boolean getHasPre() {
        if (Objects.isNull(current) || Objects.isNull(total)) {
            return false;
        }
        if (current > 1) {
            return true;
        }
        return false;
    }
}
